home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / include / x11 / initiali.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-11  |  10.3 KB  |  361 lines

  1. /* $XConsortium: InitialI.h,v 1.64.1.1 93/07/20 16:26:20 kaleb Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  5. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.                         All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its 
  10. documentation for any purpose and without fee is hereby granted, 
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in 
  13. supporting documentation, and that the names of Digital or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.  
  16.  
  17. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. /****************************************************************
  28.  *
  29.  * Displays
  30.  *
  31.  ****************************************************************/
  32.  
  33. #ifndef X_NOT_POSIX
  34. #ifdef _POSIX_SOURCE
  35. #include <limits.h>
  36. #else
  37. #define _POSIX_SOURCE
  38. #include <limits.h>
  39. #undef _POSIX_SOURCE
  40. #endif
  41. #endif
  42. #ifndef PATH_MAX
  43. #include <sys/param.h>
  44. #ifndef PATH_MAX
  45. #ifdef MAXPATHLEN
  46.  
  47. #ifndef __WATCOMC__
  48. #define PATH_MAX MAXPATHLEN
  49. #endif
  50.  
  51. #else
  52. #define PATH_MAX 1024
  53. #endif
  54. #endif
  55. #endif
  56.  
  57. #include "fd.h"
  58.  
  59. typedef struct _TimerEventRec {
  60.         struct timeval        te_timer_value;
  61.     struct _TimerEventRec *te_next;
  62.     XtTimerCallbackProc   te_proc;
  63.     XtAppContext          app;
  64.     XtPointer          te_closure;
  65. } TimerEventRec;
  66.  
  67. typedef struct _InputEvent {
  68.     XtInputCallbackProc   ie_proc;
  69.     XtPointer          ie_closure;
  70.     struct _InputEvent    *ie_next;
  71.     struct _InputEvent    *ie_oq;
  72.     XtAppContext          app;
  73.     int              ie_source;
  74.     XtInputMask          ie_condition;
  75. } InputEvent;
  76.  
  77. typedef struct _WorkProcRec {
  78.     XtWorkProc proc;
  79.     XtPointer closure;
  80.     struct _WorkProcRec *next;
  81.     XtAppContext app;
  82. } WorkProcRec;
  83.  
  84.  
  85. typedef struct 
  86. {
  87.       Fd_set rmask;
  88.     Fd_set wmask;
  89.     Fd_set emask;
  90.     int    nfds;
  91.     int    count;
  92. } FdStruct;
  93.  
  94. typedef struct _LangProcRec {
  95.     XtLanguageProc    proc;
  96.     XtPointer        closure;
  97. } LangProcRec;
  98.  
  99. typedef struct _ProcessContextRec {
  100.     XtAppContext    defaultAppContext;
  101.     XtAppContext    appContextList;
  102.     ConverterTable    globalConverterTable;
  103.     LangProcRec        globalLangProcRec;
  104. } ProcessContextRec, *ProcessContext;
  105.  
  106. typedef struct {
  107.     char*    start;
  108.     char*    current;
  109.     int        bytes_remaining;
  110. } Heap;
  111.  
  112. typedef struct _DestroyRec DestroyRec;
  113.  
  114. typedef struct _XtAppStruct {
  115.     XtAppContext next;        /* link to next app in process context */
  116.     ProcessContext process;    /* back pointer to our process context */
  117.     InternalCallbackList destroy_callbacks;
  118.     Display **list;
  119.     TimerEventRec *timerQueue;
  120.     WorkProcRec *workQueue;
  121.     InputEvent **input_list;
  122.     InputEvent *outstandingQueue;
  123.     XrmDatabase errorDB;
  124.     XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
  125.     XtErrorHandler errorHandler, warningHandler;
  126.     struct _ActionListRec *action_table;
  127.     ConverterTable converterTable;
  128.     unsigned long selectionTimeout;
  129.     FdStruct fds;
  130.     short count;            /* num of assigned entries in list */
  131.     short max;                /* allocate size of list */
  132.     short last;
  133.     short input_max;            /* elts input_list init'd with */
  134.     Boolean sync, being_destroyed, error_inited;
  135. #ifndef NO_IDENTIFY_WINDOWS
  136.     Boolean identify_windows;        /* debugging hack */
  137. #endif
  138.     Heap heap;
  139.     String * fallback_resources;    /* Set by XtAppSetFallbackResources. */
  140.     struct _ActionHookRec* action_hook_list;
  141.     int destroy_list_size;        /* state data for 2-phase destroy */
  142.     int destroy_count;
  143.     int dispatch_level;
  144.     DestroyRec* destroy_list;
  145.     Widget in_phase2_destroy;
  146.     LangProcRec langProcRec;
  147.     struct _TMBindCacheRec * free_bindings;
  148. } XtAppStruct;
  149.  
  150. #ifdef XTTRACEMEMORY
  151.  
  152.  
  153. extern char *_XtHeapMalloc(
  154. #if NeedFunctionPrototypes
  155.     Heap*    /* heap */,
  156.     Cardinal    /* size */,
  157.     char *    /* file */,
  158.     int        /* line */
  159. #endif
  160. );
  161.  
  162. #define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__)
  163.  
  164. #else /* XTTRACEMEMORY */
  165.  
  166. extern char* _XtHeapAlloc(
  167. #if NeedFunctionPrototypes
  168.     Heap*    /* heap */,
  169.     Cardinal    /* size */
  170. #endif
  171. );
  172.  
  173. #endif /* XTTRACEMEMORY */
  174.  
  175. extern void _XtSetDefaultErrorHandlers(
  176. #if NeedFunctionPrototypes
  177.     XtErrorMsgHandler*    /* errMsg */,
  178.     XtErrorMsgHandler*    /* warnMsg */,
  179.     XtErrorHandler*    /* err */,
  180.     XtErrorHandler*    /* warn */
  181. #endif
  182. );
  183.  
  184. extern void _XtSetDefaultSelectionTimeout(
  185. #if NeedFunctionPrototypes
  186.     unsigned long* /* timeout */
  187. #endif
  188. );
  189.  
  190. extern XtAppContext _XtDefaultAppContext(
  191. #if NeedFunctionPrototypes
  192.     void
  193. #endif
  194. );
  195.  
  196. extern ProcessContext _XtGetProcessContext(
  197. #if NeedFunctionPrototypes
  198.     void
  199. #endif
  200. );
  201.  
  202. Display *
  203. _XtAppInit(
  204. #if NeedFunctionPrototypes
  205.     XtAppContext*    /* app_context_return */,
  206.     String        /* application_class */,
  207.     XrmOptionDescRec*    /* options */,
  208.     Cardinal        /* num_options */,
  209.     int*        /* argc_in_out */,
  210.     String**        /* argv_in_out */,
  211.     String*        /* fallback_resources */
  212. #endif
  213. );
  214.  
  215. extern void _XtDestroyAppContexts(
  216. #if NeedFunctionPrototypes
  217.     void
  218. #endif
  219. );
  220.  
  221. extern void _XtCloseDisplays(
  222. #if NeedFunctionPrototypes
  223.     void
  224. #endif
  225. );
  226.  
  227. extern int _XtAppDestroyCount;
  228. extern int _XtDpyDestroyCount;
  229.  
  230. extern int _XtwaitForSomething(
  231. #if NeedFunctionPrototypes
  232.     _XtBoolean         /* ignoreTimers */,
  233.     _XtBoolean         /* ignoreInputs */,
  234.     _XtBoolean         /* ignoreEvents */,
  235.     _XtBoolean         /* block */,
  236.     unsigned long*    /* howlong */,
  237.     XtAppContext     /* app */
  238. #endif
  239. );
  240.  
  241. typedef struct _CaseConverterRec *CaseConverterPtr;
  242. typedef struct _CaseConverterRec {
  243.     KeySym        start;        /* first KeySym valid in converter */
  244.     KeySym        stop;        /* last KeySym valid in converter */
  245.     XtCaseProc        proc;        /* case converter function */
  246.     CaseConverterPtr    next;        /* next converter record */
  247. } CaseConverterRec;
  248.  
  249. typedef struct _XtPerDisplayStruct {
  250.     InternalCallbackList destroy_callbacks;
  251.     Region region;
  252.     CaseConverterPtr case_cvt;        /* user-registered case converters */
  253.     XtKeyProc defaultKeycodeTranslator;
  254.     XtAppContext appContext;
  255.     unsigned long keysyms_serial;      /* for tracking MappingNotify events */
  256.     KeySym *keysyms;                   /* keycode to keysym table */
  257.     int keysyms_per_keycode;           /* number of keysyms for each keycode*/
  258.     int min_keycode, max_keycode;      /* range of keycodes */
  259.     KeySym *modKeysyms;                /* keysym values for modToKeysysm */
  260.     ModToKeysymTable *modsToKeysyms;   /* modifiers to Keysysms index table*/
  261.     unsigned char isModifier[32];      /* key-is-modifier-p bit table */
  262.     KeySym lock_meaning;           /* Lock modifier meaning */
  263.     Modifiers mode_switch;           /* keyboard group modifiers */
  264.     Boolean being_destroyed;
  265.     Boolean rv;                   /* reverse_video resource */
  266.     XrmName name;               /* resolved app name */
  267.     XrmClass class;               /* application class */
  268.     Heap heap;
  269.     struct _GCrec *GClist;           /* support for XtGetGC */
  270.     Drawable **pixmap_tab;             /* ditto for XtGetGC */
  271.     String language;               /* XPG language string */
  272.     Time last_timestamp;           /* from last event dispatched */
  273.     int multi_click_time;           /* for XtSetMultiClickTime */
  274.     struct _TMKeyContextRec* tm_context;     /* for XtGetActionKeysym */
  275.     InternalCallbackList mapping_callbacks;  /* special case for TM */
  276.     XtPerDisplayInputRec pdi;           /* state for modal grabs & kbd focus */
  277.     struct _WWTable *WWtable;           /* window to widget table */
  278.     XrmDatabase *per_screen_db;        /* per screen resource databases */
  279.     XrmDatabase cmd_db;               /* db from command line, if needed */
  280.     XrmDatabase server_db;           /* resource property else .Xdefaults */
  281. } XtPerDisplayStruct, *XtPerDisplay;
  282.  
  283. typedef struct _PerDisplayTable {
  284.     Display *dpy;
  285.     XtPerDisplayStruct perDpy;
  286.     struct _PerDisplayTable *next;
  287. } PerDisplayTable, *PerDisplayTablePtr;
  288.  
  289. extern PerDisplayTablePtr _XtperDisplayList;
  290.  
  291. extern XtPerDisplay _XtSortPerDisplayList(
  292. #if NeedFunctionPrototypes
  293.     Display* /* dpy */
  294. #endif
  295. );
  296.  
  297. /*
  298. extern XtPerDisplay _XtGetPerDisplay( Display* );
  299. extern XtPerDisplayInputRec* _XtGetPerDisplayInput( Display* );
  300. */
  301.  
  302. #ifdef DEBUG
  303. #define _XtGetPerDisplay(display) \
  304.     ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
  305.      ? &_XtperDisplayList->perDpy \
  306.      : _XtSortPerDisplayList(display))
  307. #define _XtGetPerDisplayInput(display) \
  308.     ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
  309.      ? &_XtperDisplayList->perDpy.pdi \
  310.      : &_XtSortPerDisplayList(display)->pdi)
  311. #else
  312. #define _XtGetPerDisplay(display) \
  313.     ((_XtperDisplayList->dpy == (display)) \
  314.      ? &_XtperDisplayList->perDpy \
  315.      : _XtSortPerDisplayList(display))
  316. #define _XtGetPerDisplayInput(display) \
  317.     ((_XtperDisplayList->dpy == (display)) \
  318.      ? &_XtperDisplayList->perDpy.pdi \
  319.      : &_XtSortPerDisplayList(display)->pdi)
  320. #endif /*DEBUG*/
  321.  
  322. extern void _XtDisplayInitialize(
  323. #if NeedFunctionPrototypes
  324.     Display*        /* dpy */,
  325.     XtPerDisplay    /* pd */,
  326.     _Xconst char*    /* name */,
  327.     XrmOptionDescRec*    /* urlist */,
  328.     Cardinal         /* num_urs */,
  329.     int*        /* argc */,
  330.     char**         /* argv */
  331. #endif
  332. );
  333.  
  334. extern void _XtCacheFlushTag(
  335. #if NeedFunctionPrototypes
  336.     XtAppContext /* app */,
  337.     XtPointer     /* tag */
  338. #endif
  339. );
  340.  
  341. extern void _XtFreeActions(
  342. #if NeedFunctionPrototypes
  343.     struct _ActionListRec* /* action_table */
  344. #endif
  345. );
  346.  
  347. extern void _XtDoPhase2Destroy(
  348. #if NeedFunctionPrototypes
  349.     XtAppContext /* app */,
  350.     int         /* dispatch_level */
  351. #endif
  352. );
  353.  
  354. extern void _XtDoFreeBindings(
  355. #if NeedFunctionPrototypes
  356.     XtAppContext /* app */
  357. #endif
  358. );
  359.  
  360. #define _XtSafeToDestroy(app) ((app)->dispatch_level == 0)
  361.